import axios from "axios";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
const mockAjax = axios.create({
  baseURL: "/mock",
  timeout: 1000,
});
mockAjax.interceptors.request.use((config) => {
  NProgress.start();
  return config;
});
mockAjax.interceptors.response.use(
  (response) => {
    NProgress.done()
    return response.data;
  },
  (error) => {
    NProgress.done()
    return Promise.reject(new Error(error.message));
  }
);
export default mockAjax;
